// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

@use "common/refactor/common-refactor.scss" as *;

.viewer-header {
  position: absolute;
  top: 0;
  grid-column: 1 / span 1;
  grid-row: 1 / span 1;
  display: grid;
  grid-template-columns: 1fr $s-92 1fr;
  justify-content: space-between;
  align-items: center;
  height: $s-48;
  width: 100vw;
  padding: $s-8 $s-12;
  transition: transform 400ms ease 300ms;
  background-color: var(--panel-background-color);
}

// FILE NAVIGATION

.nav-zone {
  display: flex;
  justify-content: flex-start;
  flex-basis: min-content;
  width: 100%;
  gap: $s-12;
}

.home-link {
  padding: 0;
  display: grid;
  place-content: center;
}

.logo-icon {
  width: $s-28;
  height: $s-28;
  fill: var(--icon-foreground-hover);
}

.sitemap-zone {
  @include flexColumn;
  position: relative;
  width: 100%;
}

.project-name {
  @include uppercaseTitleTipography;
  color: var(--title-foreground-color);
}

.sitemap-text {
  @include flexRow;
}

.breadcrumb {
  @include bodySmallTypography;
  @include flexRow;
  color: var(--title-foreground-color);
  cursor: pointer;
}

.breadcrumb-text {
  @include textEllipsis;
  max-width: 12vw; // This is a fallback
  max-width: 12cqw; // This is a unit refered to container
}

.icon {
  @include flexCenter;
  height: $s-16;
  width: $s-16;
  svg {
    @extend .button-icon-small;
    transform: rotate(90deg);
    stroke: var(--icon-foreground);
  }
}

.dropdown {
  position: absolute;
}

.dropdown-sitemap {
  @extend .menu-dropdown;
  left: 0;
  top: calc($s-2 + $s-48);
  width: $s-272;
  padding: $s-6;
}

.dropdown-element {
  @extend .dropdown-element-base;
  .icon-check {
    @include flexCenter;
    height: 100%;
    width: $s-16;
    svg {
      @extend .button-icon-small;
      stroke: var(--icon-foreground);
    }
  }
  &:hover .label {
    color: var(--input-foreground-color-active);
  }
}

.current-frame {
  @include bodySmallTypography;
  @include flexRow;
  flex-grow: 1;
  color: var(--title-foreground-color-hover);
  cursor: pointer;
  .icon svg {
    stroke: var(--title-foreground-color-hover);
  }
}

.frame-name {
  @include textEllipsis;
  max-width: 17vw; // This is a fallback
  max-width: 17cqw; // This is a unit refered to container
}

// SECTION BUTTONS
.mode-zone {
  @include flexRow;
  height: 100%;
}

.mode-zone-btn {
  @extend .button-tertiary;
  @include flexCenter;
  height: $s-32;
  width: $s-28;
  padding: 0;
  svg {
    @extend .button-icon;
  }
}

.selected {
  @extend .button-icon-selected;
}

// OPTION AREA
.options-zone {
  @include flexRow;
  position: relative;
  justify-content: flex-end;
  gap: $s-8;
  z-index: $z-index-10;
}

.view-options {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.fullscreen-btn {
  @extend .button-tertiary;
  @include flexCenter;
  height: $s-32;
  width: $s-28;
  svg {
    @extend .button-icon;
    stroke: var(--icon-foreground);
  }
}

.share-btn {
  @extend .button-primary;
  height: $s-32;
  min-width: $s-72;
  margin-left: $s-4;
}

.edit-btn {
  @extend .button-tertiary;
  @include flexCenter;
  height: $s-32;
  width: $s-28;
  svg {
    @extend .button-icon;
    stroke: var(--icon-foreground);
  }
}

.go-log-btn {
  @extend .button-tertiary;
  @include bodySmallTypography;
  height: $s-32;
  padding: 0 $s-8;
  border-radius: $br-8;
  color: var(--button-tertiary-foreground-color-rest);
}

// ZOOM WIDGET
.zoom-widget {
  @include buttonStyle;
  @include flexCenter;
  height: $s-28;
  min-width: $s-64;
  border-radius: $br-8;
  .label {
    @include bodySmallTypography;
    color: var(--button-tertiary-foreground-color-rest);
  }

  &:hover {
    .label {
      color: var(--button-tertiary-foreground-color-focus);
    }
  }
  &.selected {
    .label {
      color: var(--button-tertiary-foreground-color-focus);
    }
  }
}

.dropdown {
  @extend .menu-dropdown;
  right: $s-2;
  top: calc($s-2 + $s-48);
  width: $s-272;
}

.basic-zoom-bar {
  display: flex;
  justify-content: space-between;
  padding: $s-6;
  cursor: auto;
}

.zoom-btns {
  display: flex;
}

.zoom-btn {
  @extend .button-tertiary;
  height: $s-28;
  width: $s-28;
  border-radius: $br-8;
  .zoom-icon {
    @include flexCenter;
    width: $s-24;
    height: $s-32;
    svg {
      @extend .button-icon;
      stroke: var(--icon-foreground);
    }
  }
  &:hover {
    .zoom-icon svg {
      stroke: var(--button-tertiary-foreground-color-hover);
    }
  }
}

.zoom-text {
  @include flexCenter;
  height: 100%;
  min-width: $s-64;
  padding: 0;
  margin: 0 $s-2;
  color: var(--modal-title-foreground-color);
}

.reset-btn {
  @extend .button-tertiary;
  color: var(--button-tertiary-foreground-color-hover);
  height: $s-28;
  border-radius: $br-8;
}

.zoom-option {
  @extend .menu-item-base;
  .shortcuts {
    @extend .shortcut-base;
    .shortcut-key {
      @extend .shortcut-key-base;
    }
  }
  &:hover {
    color: var(--menu-foreground-color-hover);
    .shortcuts {
      .shortcut-key {
        color: var(--menu-foreground-color-hover);
      }
    }
  }
}

/** FULLSCREEN */
[data-fullscreen="true"] .viewer-header::after {
  content: " ";
  position: absolute;
  width: 100%;
  height: $s-48;
  left: 0;
  top: $s-48;
}

[data-fullscreen="true"] .viewer-header {
  transform: translateY(-$s-48);
}

[data-force-visible="true"] .viewer-header,
[data-fullscreen="true"] .viewer-header:hover {
  transform: translateY(0);
}
